import { injectable } from 'inversify'
import { plainToClass } from 'class-transformer'
import { validate } from 'class-validator'
import { PostDto } from './post.dto'

/**
 * ## Post 逻辑层
 */
@injectable()
export class PostServices {
  constructor() { }

  public get() {
    return 'get success'
  }

  public async post(post: PostDto) {
    let postDto = plainToClass(PostDto, post)
    const errors = await validate(postDto)
    console.log(errors);

    return 'post success'
  }
}
